package com.bay1ts.controller;

import com.bay1ts.domain.Request;
import com.bay1ts.service.RequestService;
import com.bay1ts.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by chenuu on 2016/4/2.
 */
@Controller
@RequestMapping("teacher")
public class TeacherController {
    @Autowired
    private RequestService requestService;
    @Autowired
    private TeacherService teacherService;
    @RequestMapping(value = "getAllApply")
    public void getAllApply(){
        List<Request> list=teacherService.getAllApply();
        //可以选择加到model里面，也可以选择用json返回。
        Map<String, List> map= requestService.getApplyDetailsSortByType(list);
    }
    @RequestMapping(value = "rejectrequest",method = RequestMethod.POST)
    public void rejectRequest(Long id,String comment){
        Map<Long,String> map=new HashMap<Long, String>();
        map.put(id,comment);
        requestService.rejectRequest(map);
    }
    @RequestMapping(value = "passrequest")
    public void passRequest(Long id){
        List<Long> ids=new ArrayList<Long>();
        ids.add(id);
        requestService.firstPassRequest(ids);
    }

}
